;;; init-edit.el --- edit config
;;; Commentary:
;;; Code:

;; 编码
(unless *is-win64*
  (set-selection-coding-system 'utf-8)
  (prefer-coding-system 'utf-8)
  (set-language-environment "UTF-8")
  (set-default-coding-systems 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (set-keyboard-coding-system 'utf-8)
  (setq locale-coding-system 'utf-8))

;; Treat clipboard input as UTF-8 string first; compound text next, etc.
(when (display-graphic-p)
  (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))

;; delsel 删除
(use-package delsel
  :defer t
  :hook (after-init . delete-selection-mode))

;; recentf 最近文件
(use-package recentf
  :defer t
  :hook (after-init . recentf-mode)
  :config
  (setq-default
   recentf-max-saved-items 1000
   recentf-exclude `("/tmp/" "/ssh:" ,(concat package-user-dir "/.*-autoloads\\.el\\'"))))

;; paren 括号匹配
(use-package paren
  :defer t
  :hook (after-init . show-paren-mode)
  :config
  (setq show-paren-when-point-inside-paren t
        show-paren-when-point-in-periphery t))

;; smartparent 自动匹配
(use-package smartparens
  :config
  (require 'smartparens-config)
  (smartparens-global-mode))

(use-package move-text
  :defer t
  :bind (("M-p" . move-text-up)
         ("M-n" . move-text-down))
  :config (move-text-default-bindings))

(provide 'init-edit)
;;; init-edit.el ends here
